﻿using System;
using System.Collections.Generic;
using System.Text;
using JDML.MappingClass;

namespace JDML.Attributes
{
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
    public class SQLAttribute : Attribute
    {
        private string sqlName = string.Empty;
        public string SQLName { get { return sqlName; } set { sqlName = value; } }
        public SQLCmdType SQLType { get; set; }
        public string SQLCommand { get; set; }
        public bool ReloadAfterInsert { get; set; }
        public bool ReloadAfterUpdate { get; set; }
        public SQLAttribute()
        {
        }
        public SQLAttribute(SQLCmdType type, string sqlCommand)
        {
            SQLType = type;
            SQLCommand = sqlCommand;
        }
        public SQLAttribute(SQLCmdType type, string sqlName, string sqlCommand, bool reloadAfterInsert = false, bool reloadAfterUpdate = false)
        {
            SQLType = type;
            SQLName = sqlName;
            SQLCommand = sqlCommand;
            ReloadAfterInsert = reloadAfterInsert;
            ReloadAfterUpdate = reloadAfterUpdate;
        }
    }
}
